<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page session="true" %>
<%@ page pageEncoding="UTF-8" %>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<%
String _iframe = request.getParameter("iframe");
if("2".equals(_iframe)){%>
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	</head>
	<body>
		<script type="text/javascript" src="<c:url value="static/js/jquery-1.7.2.min.js" />"></script>
		<script type="text/javascript" src="<c:url value="static/js/messenger.js" />"></script>
		<script type="text/javascript">
			var messenger = new Messenger('ssologin', 'myfirefly-moming-passport');
			messenger.addTarget(window.parent, 'ssoclient');
			messenger.targets['ssoclient'].send('noauth');
			
			
		</script>
	</body>
</html>
<%}else{%>
<html>
<head>
    <meta charset="utf-8">
    <title>墨明--用户登录</title>
    <link rel="stylesheet" type="text/css" href="static/css/public.css">
    <link rel="stylesheet" type="text/css" href="static/css/static/staff_login.css">
    <script type="text/javascript" src="static/js/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" src="static/js/static/staff_login.js"></script>
</head>
<script type="text/javascript">
$(document).ready(function(){
				if (window.top != window) {
					window.top.location.href= "/myfirefly-moming-passport/logout";
				}
				var msg = $("#msg1").html();
				if(msg=="您输入的验证码错误"){
					$("#msg1").hide();
				}else{
					$("#msg2").hide();
				}
				
				var submitBtn = document.getElementById("fm1");
				 
				 submitBtn.onclick = function (event) {
					 var flag = $("#checkCode").val();
						if(flag){
							return;
						}
				 };
			});
function queryCode(){
	var captcha = $("input[name='captcha']").val();
	$.ajax({
		type     : 'POST',
		async    : false,
		dataType : 'json',
		url      : 'captchaCheck',
		data     : {code:captcha},
		cache    : false,
		success  : function(json) {
			var flag = json.result;
			if(!flag){
				$("#checkcodelabel").html("您输入的验证码错误");
			}else{
				$("#checkcodelabel").html("");
			}
			$("#checkCode").val(flag);
		}
	});
}	


</script>
<body>
    <article>
        <div class="login_div">
            <p class="title">墨明--用户登录</p>
			
			<input type="hidden" id="checkCode"/>
			
			<form:form method="post" id="fm1" cssClass="ui-form" commandName="${commandName}" htmlEscape="true">
							<!--  fieldset>
			                  <div class="prompt">
			                    <label class="error" id="allError"><form:errors  path="*" id="msg" cssClass="errors" element="div" /></label>
			                  </div>-->
			                  <div class="row_div name_div">
			                    <c:if test="${not empty sessionScope.openIdLocalId}">
								<strong>${sessionScope.openIdLocalId}</strong>
								<input type="hidden" id="username" name="username" value="${sessionScope.openIdLocalId}" />
								</c:if>
		
								<c:if test="${empty sessionScope.openIdLocalId}">
								<form:input cssClass="input1" id="username" size="25" placeholder="请输入帐号"
									tabindex="1" accesskey="${userNameAccessKey}" path="username" autocomplete="false" htmlEscape="true" />
								</c:if>
								<div class="prompt">
								<label class="error" id="allError"><form:errors id="msg1" cssClass="errors" element="div" /></label>
								
								<label class="error" id="allError"><form:errors path="username" id="msg" cssClass="errors" element="div" /></label>
								</div>
			                  </div>
			                  <div class="row_div pass_div">
			                    <form:password cssClass="input1 input-icon input-bg-gray" id="password" size="25" placeholder="请输入密码"
			                    	tabindex="2" path="password"  accesskey="${passwordAccessKey}" htmlEscape="true" autocomplete="off" />
			                    <div class="prompt">
								<label class="error" id="allError"><form:errors path="password" id="msg" cssClass="errors" element="div" /></label>
								
								 </div> 
			                  </div>
			                  <div class="verification_div">
			                    <input id="validcode" name="captcha" type="text" class="input2 input-icon input-icon-code ui-textarea"
			                                   tabindex="3" placeholder="请输入验证码"  onblur="queryCode()">
			                    <div class="img_div">
			                    	<img id="captcha_img" src="validcode.png"  class="img-code"/>
			                    </div>
			                    <div class="prompt">
			                    <label class="error" id="checkcodelabel"></label>
			                    <label class="error" id="allError"><form:errors id="msg2" cssClass="errors" element="div" /></label>
								<label class="error" id="allError"><form:errors path="captcha" id="msg" cssClass="errors" element="div" /></label>
								 </div>
			                  </div>
			                  
			                  <div class="ui-form-item text-center2">
			                    <input class="btn radius btn-secondary" type="submit" id="submit_login" name="submit" value="立即登录" >
			                  </div>
			                  <div class="xuxian"></div>
			                  <div class="ui-form-item text-center">
			                    <p class="go-reg"> &nbsp; 
			                    </p>
			                  </div>
			                  <div style="display:none">
			                  	<input id="warn" name="warn" value="true" type="checkbox" />
			                  	<input type="hidden" name="lt" value="${loginTicket}" />
								<input type="hidden" name="execution" value="${flowExecutionKey}" />
								<input type="hidden" name="_eventId" value="submit" />
			                  </div>
			                <!--  /fieldset>-->
			            	
						</form:form>


        </div>
    </article>
    <footer>
        <p>Copyright@2018-2019 www.myfirefly.cn All Rights Resserved.</p>
    </footer>
</body>
</html>

<%}%>